package com.deryun.tyl.bean.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import com.deryun.tyl.bean.News;

public interface NewsMapper {
	
	@Select({
		"SELECT * FROM news ORDER BY id DESC"
	})
	List<News> getAllNews();
	
	@Insert({
		"INSERT INTO news (title,context,publishDate) VALUES ("
		+ "#{title,jdbcType=VARCHAR},"
		+ "#{context,jdbcType=VARCHAR},"
		+ "#{publishDate,jdbcType=VARCHAR})"
	})
	int addNews(News news);
	
	@Delete({
		"DELETE FROM news WHERE id = #{0,jdbcType=INTEGER}"
	})
	int deleteNews(int id);
}
